import styles from './index.less';
import Drugapi from '../api/drug.api'
import HTTP from '../services/api';
import { Table } from 'antd'
import { useEffect, useState,useContext,useRef,useReducer } from 'react';
const columns = [
    {
        title: '药品名称',
        dataIndex: 'drug_name',
    },
    {
        title: '药品的价格',
        dataIndex: 'price',
    },
    {
        title: '药品的数量',
        dataIndex: 'count',
    },
    {
        title: '药品的规格',
        dataIndex: 'specification',
    },
    {
        title: '药品的单位',
        dataIndex: 'unit',
    },
    {
        title: '备注',
        dataIndex: 'comment'
    }
];

export default function Drug() {
    const [druginfo, setDruginfo] = useState([])
    const [userlist, setUserlist] = useState([])

    async function getAllDrugInfo() {
        let result = await HTTP({ method: 'get' }, Drugapi.getAllDrugInfo)
        if (result && result.status) {
            setDruginfo(result.info.rows)
        }
        console.log(result)
    }
    useEffect(() => {
        getAllDrugInfo()
    },[])

    return (
        <div>
            <Table dataSource={druginfo} columns={columns}></Table>
        </div>
    )
}
